<?php

namespace app\models\db;

use Yii;

/**
 * This is the model class for table "t_goods_detail_html".
 *
 * @property string $goods_id
 * @property string $goods_code
 * @property string $detail_html
 *
 * @property Goods $goods
 */
class GoodsDetailHtml extends \yii\db\ActiveRecord
{
    /**
     * @inheritdoc
     */
    public static function tableName()
    {
        return 't_goods_detail_html';
    }

    /**
     * @inheritdoc
     */
    public function rules()
    {
        return [
            [['goods_id'], 'required'],
            [['detail_html'], 'string'],
            [['goods_id'], 'string', 'max' => 36],
            [['goods_code'], 'string', 'max' => 255],
            [['goods_id'], 'exist', 'skipOnError' => true, 'targetClass' => Goods::className(), 'targetAttribute' => ['goods_id' => 'id']],
        ];
    }

    /**
     * @inheritdoc
     */
    public function attributeLabels()
    {
        return [
            'goods_id' => 'Goods ID',
            'goods_code' => 'Goods Code',
            'detail_html' => 'Detail Html',
        ];
    }

    /**
     * @return \yii\db\ActiveQuery
     */
    public function getGoods()
    {
        return $this->hasOne(Goods::className(), ['id' => 'goods_id']);
    }
}
